package action.member;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ModelDriven;

import action.common.MyBaseAction;
import dao.pojo.WchatYun;
import security.MySecurityContextHandle;
import service.interf.IWchatYun;

public class WchatYunMobiAction extends MyBaseAction<WchatYun> implements ModelDriven<WchatYun> {

	private static final long serialVersionUID = 1L;
	private IWchatYun iWchatYun;

	public void setiWchatYun(IWchatYun iWchatYun) {
		this.iWchatYun = iWchatYun;
	}

	public WchatYunMobiAction() {
		super(WchatYun.class);
	}

	public WchatYun getModel() {
		return model;
	}

	/**
	 * 绑定
	 */
	public void bind() {
		System.out.println("bind.start");
		String r = "1";
		try {
			model.setWchatId(MySecurityContextHandle.getItem("wchatId"));
			System.out.println(model.getWchatId());
			System.out.println(model.getYunId());
			r = iWchatYun.bind(model.getWchatId(), model.getYunId());
			System.out.println(r);
		} catch (Exception e) {
			System.out.println("exception");
			r = errorHandle.handleErr(e);
		}
		System.out.println(r);
		servletHandle.writeToClient1(ServletActionContext.getResponse(), r);
	}

}
